package edu.nf.vac.vaccination.task;

import cn.hutool.core.date.DateUtil;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import edu.nf.vac.vaccination.dao.NeedleNumDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @Author : PYY
 * @create 2022/3/30
 */
@Component
@Slf4j
public class NeedleNumJob {
    @Autowired
    private NeedleNumDao dao ;

    @XxlJob("needleNumJobHandler")
    public void updateStatus(){
        Date today = DateUtil.parse(DateUtil.today(), "yyyy-MM-dd");
        dao.updateVaccineStatus(today);
        log.info("已清理..."+today+"针次信息");
        XxlJobHelper.log("已清理..."+today+"针次信息");
    }
}